import axios from 'axios';
const baseUrl = 'https://lottery.qnsyw.cn/api/';
export function get(url, params = {}) {
  return new Promise((resolve, reject) => {
    axios.get(baseUrl + url, {
        params: params,
        headers: {
          Authorization: window.sessionStorage.getItem('token'),
        },
      })
      .then((res) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
}

export function post(url, data) {
  return new Promise((resolve, reject) => {
    axios.post(baseUrl + url, data).then(
      (res) => {
        resolve(res.data);
      },
      (err) => {
        reject(err);
      },
    );
  });
}
